package com.web.core.base.dao;

import org.springframework.stereotype.Repository;

import com.blue.jdbc.BaseDao;
import com.web.core.base.model.Config;

@Repository
public class ConfigDao extends BaseDao<Config>
{
	public ConfigDao()
	{
	}

	@Override
	protected void query(StringBuilder sql, Config param)
	{
		if (param != null)
		{
			if (param.getKey() != null && !param.getKey().isEmpty())
			{
				sql.append(" and a.`key` like :key");
				param.setKey("%" + param.getKey() + "%");
			}
			if (param.getDescp() != null && !param.getDescp().isEmpty())
			{
				sql.append(" and a.descp like :descp");
				param.setDescp("%" + param.getDescp() + "%");
			}
			
			if (param.getState() != null)
				sql.append(" and a.state=:state");
		}
	}
	
}
